<?php require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
  MYDCONN();
  $GLOBALS['MYT'] = $GLOBALS['MYD']; 
  form_pr('getInvoices','','','post'); ?>
<div class="title">Pesquisar</div>
<table width="98%"  border="0" cellpadding="3" cellspacing="1">
    <tr bgcolor="#F2F2F2">
      <td>De:
       <?php mn_field('date','ED','TimeStart',date("Y-m-01"),'getInvoices','8','','');
       echo ' a ';
       mn_field('date','ED','TimeEnd','','getInvoices','8','',''); ?></td>
      <td>Conta: 
      <?php mn_field('text','ED','Conta','','6','6','',''); ?></td>
      <td>Estado
      <?php mn_field('hselect','ED','Status','',"Todos;Lancado;Pago;Arquivado;Cancelado#;1;2;3;5",'Todas','',''); ?></td>
      <td>Data
      <?php mn_field('hselect','ED','TimeType','',"Limite de Pagamento;Pagamento;Emissao;Lancamento#TimePay;TimeClose;TimeInvoice;Time",'','',''); ?></td>
      <td>N. Interno
      <input name="Invoice" type="text" id="Invoice" size="6"></td>
      <td>Valor
      <input name="Amount" type="text" id="Amount" size="10"></td>
      <td>N. Factura
      <input name="IReference" type="text" id="IReference2" size="8"></td>
    </tr>
    <tr bgcolor="#F2F2F2">
    <td colspan="6">Fornecedor
    <?php 
    $qrProv = "SELECT ccenter_providers.ref AS ID, ccenter_providers.name AS NAME
	  			FROM ccenter_providerscodes
				INNER JOIN ccenter_providers ON ccenter_providers.ref = ccenter_providerscodes.RefProvider
				WHERE Status != 5
				GROUP BY ccenter_providers.ref
				ORDER BY name ASC";
    mn_field('select','ED','Provider','',$qrProv,' ','',''); ?></td>
    <td><?php mn_field('button','ED','Search','Pesquisar','','','','" onclick="
    		document.getInvoices.action=\'Modules/CentrodeCustos/Lib/rs_invoices.php\';
    		subform(\'getInvoices\',\'rsInvoices\');'); ?></td>
    </tr>
</table>
<?php mn_field('hidden','ED','POOL','','','','',''); ?>
</form>
<div id="rsInvoices"></div>